package com.whty.cms.filewps.common.configure;

import com.jfinal.template.ext.spring.JFinalViewResolver;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;

@Configuration
public class MyViewResolver extends JFinalViewResolver implements ApplicationListener<ContextRefreshedEvent> {

	/**
	 * 添加默认路径
	 * @param contextRefreshedEvent
	 */
	@Override
	public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
		getEngine().addSharedObject("ctx", getServletContext().getContextPath());
	}
}
